<?php

/**
 * 文件由尚数增量代码引擎生成
 * @author: Shann 851188611@qq.com
 */

namespace app\model;

use think\Model;
use think\model\concern\SoftDelete;

class OrderBase extends Model
{
    use SoftDelete;

    protected $table = 'order';

    protected $autoWriteTimestamp = true;

    protected $createTime = 'created_at';

    protected $updateTime = 'updated_at';

    protected $deleteTime = 'deleted_at';

    protected $strict = false;

    protected $convertNameToCamel = true;

    public function products() {
        return $this->hasMany(OrderProduct::class, 'order_id', 'id');
    }

    public function payments() {
        return $this->hasMany(OrderPayment::class, 'order_id', 'id');
    }

    public function merchant() {
        return $this->hasOne(Merchant::class, 'id', 'merchant_id');
    }
}